package 实验.实验四;

public class ShapeManager {
    private Shape[] shapes;
    public ShapeManager(int size){
        shapes = new Shape[size];
    }
    public void addShape(Shape shape, int index){
        shapes[index] = shape;
    }
    public double getTotalArea(){
        double totalArea = 0;
        for(Shape shape : shapes){
            if(shape != null){
                totalArea += shape.getArea();
            }
        }
        return totalArea;
    }
}

